package com.shengdong.water.code.api

import com.shengdong.water.base.BaseResponse
import com.shengdong.water.code.bean.GovernBean
import com.shengdong.water.code.bean.MapDataBean
import com.shengdong.water.code.bean.MapOutletBean
import com.shengdong.water.code.bean.NotifyMsg
import com.shengdong.water.code.bean.Outlet
import com.shengdong.water.code.bean.OutletCategoryBean
import com.shengdong.water.code.bean.PageData
import com.shengdong.water.code.bean.RealTimeBean
import com.shengdong.water.code.bean.SignInBean
import com.shengdong.water.code.bean.TreeNode
import com.shengdong.water.code.bean.UploadBean
import com.shengdong.water.code.bean.UserToken
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Query
import retrofit2.http.QueryMap
import java.util.Objects

interface ApiService {


    @POST("api/sdzn-framework-auth/token")
    @Headers("Content-Type: application/x-www-form-urlencoded")
    suspend fun userToken(
        @Query("grantType") grantType: String,
        @Query("account") account: String,
        @Query("password") password: String,
    ): Response<BaseResponse<UserToken>>

    @GET("api/sdzn-framework-admin/notice/getNotifyMsgPage")
    suspend fun getNotifyMsg(@Query("current") current: Int, @Query("size") size: Int): Response<BaseResponse<PageData<NotifyMsg>>>


    @GET("api/sdzn-bussiness-monitor/outlet/getAll")
    suspend fun getAllOutlet(): Response<BaseResponse<MutableList<Outlet>>>

    @GET("api/sdzn-bussiness-monitor/outlet/list")
    suspend fun getOutletList(@Query("name") name: String,@Query("current") current: Int, @Query("size") size: Int): Response<BaseResponse<PageData<Outlet>>>


    @POST("api/sdzn-bussiness-monitor/sign/submit")
    suspend fun submitSign(@Body map: RequestBody): Response<BaseResponse<Any>>


    @GET("api/sdzn-bussiness-monitor/sign/list")
    suspend fun getSignList(
        @Query("signIn") sign: MutableMap<String, Any>,
        @Query("current") current: Int,
        @Query("size") size: Int
    ): Response<BaseResponse<PageData<SignInBean>>>

    @GET("api/sdzn-bussiness-monitor/sign/detail")
    suspend fun getSignDetail(@Query("id") id: String): Response<BaseResponse<SignInBean>>

    @Multipart
    @POST("api/sdzn-framework-io/file/fileUpload")
    suspend fun uploadFile(@Part file: MultipartBody.Part): Response<BaseResponse<UploadBean>>

    @GET("api/sdzn-framework-admin/dict/dictionary?code=sewage_outlets")
    suspend fun getDictionary(): Response<BaseResponse<MutableList<OutletCategoryBean>>>

    @GET("api/sdzn-bussiness-monitor/govern/list")
    suspend fun getGovernList(@Query("current") current: Int, @Query("size") size: Int): Response<BaseResponse<PageData<GovernBean>>>

    @GET("api/sdzn-bussiness-monitor/realtime/list")
    suspend fun getRealTimeList(@QueryMap map: Map<String, @JvmSuppressWildcards Any>): Response<BaseResponse<PageData<RealTimeBean>>>

    @GET("api/sdzn-bussiness-monitor/realtime/detail")
    suspend fun getRealTimeDetail(@Query("id") id: String): Response<BaseResponse<RealTimeBean>>


    @GET("api/sdzn-function-thirdparty/largeScreen/getAdministrativeArea")
    suspend fun getAdministrativeArea(@Query("childLevel") level: Int, @Query("keyword") keyword: String): Response<BaseResponse<MapDataBean>>

    @GET("api/sdzn-bussiness-monitor/largeScreen/getOutletInfoOnMap")
    suspend fun getOutletInfoOnMap(): Response<BaseResponse<MapOutletBean>>

    @GET("api/sdzn-function-thirdparty/hikRegion/getRegionStructure")
    suspend fun getRegionStructure(): Response<BaseResponse<MutableList<TreeNode>>>

    @GET("api/sdzn-function-thirdparty/hikRegion/getCameraUrl")
    suspend fun getCameraUrl(@Query("cameraIndexCode") cameraIndexCode: String , @Query("protocol") protocol : String ): Response<BaseResponse<Any>>

}